<?php
function alert_form($msg, $url){
    echo "<script LANGUAGE=\"javascript\">alert (\"$msg\");window.location.href=\"$url\";</script>";
}
function alert_ajax($msg, $url){
    echo "alert (\"$msg\");";
}
function query_select($sql){
    $db = new mysqli('localhost', 'root', '123456', 'test', 3306);
    if (mysqli_connect_errno())
    {
        echo 'MySQL连接错误: ';
        echo mysqli_connect_error();
    }
    $result = $db->query($sql);
    return $result->fetch_all(MYSQLI_ASSOC); # 键值对模式
}
function query($sql){
    $db = new mysqli('localhost', 'root', '123456', 'test', 3306);
    if (mysqli_connect_errno())
    {
        echo 'MySQL连接错误: ';
        echo mysqli_connect_error();
    }
    $result = $db->query($sql);
    return $result;
}
?>